package com.study.thirdlib.livedatabus

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.study.thirdlib.livedatabus.event.MyMsg
import com.jeremyliao.liveeventbus.LiveEventBus
import com.study.thirdlib.R
import com.study.thirdlib.databinding.ActivityBusbBinding
import org.jetbrains.anko.sdk27.coroutines.onClick


/**
 * <pre>
 *     author : slx
 *     time   : 2020/11/25
 *     desc   :
 * </pre>
 */
class BusBActivity : AppCompatActivity() {

    lateinit var mBinding: ActivityBusbBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_busb)

        mBinding.btnSendMsg.onClick {
            // 发送消息
            LiveEventBus.get("key")
                .post("fauks")

            LiveEventBus.get(MyMsg::class.java)
                .post(MyMsg("bean msg"))
        }
    }
}